package com.shawn.springboot.integeration.validation.model;

import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * @author shawn
 * @description: 用户注册请求
 * @date 2023/12/12
 */
@Data
public class User {
    @NotBlank(message = "用户名不允许为空")
    private String username;

    @Size(min = 2, max = 20, message = "全名个数必须在2到20之间")
    private String fullName;

    @Min(value = 18, message = "年龄必须不小于18")
    private int age;

    @Email(message = "邮箱输入无效")
    private String email;

    @Pattern(regexp = "^[0-9]{11}$", message = "手机号必须是11位")
    private String phoneNumber;
}
